* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.admin-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.back-btn svg {
    flex-shrink: 0;
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-name {
    font-size: 14px;
    opacity: 0.9;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 12px;
    opacity: 0.9;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.user-list {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.user-list h3 {
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
}

.user-count {
    padding: 12px 20px;
    font-size: 14px;
    color: #6b7280;
    background: #f9fafb;
}

#onlineCount {
    font-weight: 600;
    color: #667eea;
}

.user-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.user-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-item:hover {
    background: #f3f4f6;
}

.user-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
}

.user-item.active .user-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.user-status {
    font-size: 12px;
    opacity: 0.7;
}

.user-time {
    font-size: 11px;
    opacity: 0.6;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.btn-secondary, .btn-danger {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
}

.btn-danger:hover:not(:disabled) {
    background: #fee2e2;
}

.btn-secondary:disabled, .btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.welcome-message {
    text-align: center;
    margin: 60px 0;
}

.welcome-message p {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.message {
    margin-bottom: 16px;
    display: flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.admin {
    justify-content: flex-start;
}

.message-content {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message.user .message-content {
    background: #e5e7eb;
    color: #1f2937;
    border-bottom-right-radius: 4px;
}

.message.admin .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.message.admin .message-time {
    text-align: left;
    color: rgba(255, 255, 255, 0.8);
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.quick-replies {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.quick-reply-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
    transition: border-color 0.3s;
    min-height: 80px;
}

#messageInput:focus {
    border-color: #667eea;
}

#messageInput::placeholder {
    color: #9ca3af;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    text-align: right;
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    transition: opacity 0.3s;
}

.connection-status.connected {
    background: rgba(74, 222, 128, 0.9);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.9);
}

.connection-status.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 滚动条样式 */
.user-items::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.user-items::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.user-items::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.user-items::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-list {
        width: 240px;
    }
    
    .quick-replies {
        gap: 4px;
    }
    
    .quick-reply-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 640px) {
    .main-content {
        flex-direction: column;
    }
    
    .user-list {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .user-items {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px;
    }
    
    .user-item {
        min-width: 120px;
        margin-right: 8px;
        margin-bottom: 0;
    }
}